Xbasic

STRTRAN_MULTI Function

Syntax

Output_String as C = STRTRAN_MULTI(C character,C substrings,C replacements)

Arguments

Output_String

The character string produced by the replacement operation.

character

The character string to search.

substrings

A list of character strings to look for.

replacements

A list of character strings to replace found instances of character strings on the substrings. Elements of the substrings and replacements are paired.

Description

Replaces occurrences of strings in one cr-lf list with strings in another cr-lf list - compare is case sensitive.

Discussion

STRTRAN_MULTI() creates a character string by replacing occurrences of entries in the substrings found in the character string to search with the corresponding entries in the replacements. The substrings argument is case sensitive.

Example

dim ss as C
dim rs as C
dim ts as C
ts = "ab1 ab2 cd1 cd2"
ss = "ab" + crlf() + "cd" + crlf()
rs = "AB" + crlf() + "CD" + crlf()
stritran_multi(ts, ss, rs)   ->   "AB1 AB2 CD1 CD2"

See Also